# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: Angel Velasquez <angvp@archlinux.org>
# Contributor: Felix Yan <felixonmars@archlinux.org>

_pyname=astroid
pkgname=python-$_pyname
pkgver=2.15.4
pkgrel=2
pkgdesc='A common base representation of python source code'
arch=(any)
url="https://github.com/PyCQA/$_pyname"
license=(LGPL)
_pydeps=(lazy-object-proxy
         typing-extensions
         wrapt)
depends=(python
         "${_pydeps[@]/#/python-}")
makedepends=(python-{build,installer,wheel}
             python-setuptools)
checkdepends=(python-numpy
              python-pip
              python-pytest
              python-regex
              python-typed-ast
              python-urllib3)
replaces=(python-logilab-astng)
conflicts=(python-logilab-astng)
_archive="$_pyname-$pkgver"
source=("$url/archive/v$pkgver/$_archive.tar.gz")
sha256sums=('a2b2d239476464c63fbfbd0dbebe589cf5ecd48820015dbb9f1c1c986fd2d6dc')

prepare() {
	cd "$_archive"
	sed -i -e '/^requires =/s/~=[0-9.]\+//g' pyproject.toml
}

build() {
	cd "$_archive"
	python -m build -wn
}

check() {
	cd "$_archive"
	pytest
}

package() {
	cd "$_archive"
	python -m installer -d "$pkgdir" dist/*.whl
}
